package com.xiaojie.api;

import com.xiaojie.entity.user.User;
import com.xiaojie.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName IndexController
 * @Description TODO
 * @Author yan
 * @Date 2021/5/21 9:56
 * @Version 1.0
 **/
@RestController
public class IndexController {
    @Autowired
    private UserService userService;

    @RequestMapping("/index")
    public List<User> index(){
        return userService.getAll();
    }

    @GetMapping("/add")
    public String addUser(String name,Integer age){
        return userService.saveUser(name,age)+"success";
    }

    @GetMapping("/test")
    public String test(){
        return "测试成功 hellojenkins。。。。";
    }
    @RequestMapping("/indexPage")
    public String indexPage(){
        return "第一次测试jenkins部署docker构建的项目";
    }

}
